A modern communications device needs to provide a large-capacity data packet cache to absorb a burst data packet. A data packet cached in the communications device constitutes a queue according to a packet descriptor of the data packet, so as to be managed, and is scheduled and sent according to a priority of the queue. To ensure that a data packet of a user is not mistakenly sent to another user, when a user goes off line, a queue including a packet descriptor corresponding to a data packet of the user needs to be flushed before the queue is reallocated to another user. An existing queue flushing manner is as follows. A queue flushing command for a queue that needs to be flushed is issued to a traffic management chip. After receiving the queue flushing command, the traffic management chip waits until the queue that needs to be flushed is scheduled and dequeued. When the queue that needs to be flushed is dequeued, all packet descriptors in the queue that needs to be flushed are removed.
When there are a relatively large quantity of queues that need to be flushed, a queue with a relatively low priority waits a relatively long time to be scheduled and dequeued. As a result, for a long time, the queue with the relatively low priority cannot be scheduled and dequeued, and a flushing completion time of the queue with the relatively low priority cannot be ensured.